﻿using DreamCMS.Entity.Common;
using DreamCMS.WebCore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DreamCMS.Entity
{
    public class UserInfo:IComparable<UserInfo>
    {
        /// <summary>
        /// 重载IComparable实现UserInfo实体元素的比较
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo(UserInfo other)
        {
            if(other.Displayorder!=this.Displayorder)
            {
                return this.Displayorder.CompareTo(other.displayorder);
            }
            return this.userid.CompareTo(other.userid);
        }
        private long userid;
        /// <summary>
        /// 用户ID
        /// </summary>
        public long Userid
        {
            get { return userid; }
            set { userid = value; }
        }
        private long type;
        /// <summary>
        /// 用户类型
        /// </summary>
        public long Type
        {
            get { return type; }
            set { type = value; }
        }
        private UserStatus status;
        /// <summary>
        /// 用户状态
        /// </summary>
        public UserStatus Status
        {
            get { return status; }
            set { status = value; }
        }
        private string userName;
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }
        private string name;
        /// <summary>
        /// 用户昵称
        /// </summary>
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private string password;
        /// <summary>
        /// 用户密码
        /// </summary>
        public string Password
        {
            get { return password; }
            set { password = value; }
        }
        private string email;
        /// <summary>
        /// 用户邮件地址
        /// </summary>
        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        private string siteurl;
        /// <summary>
        /// 用户个人主页
        /// </summary>
        public string Siteurl
        {
            get { return siteurl; }
            set { siteurl = value; }
        }
        private string description;
        /// <summary>
        /// 用户描述
        /// </summary>
        public string Description
        {
            get { return description; }
            set { description = value; }
        }
        private string avatarurl;
        /// <summary>
        /// 用户头像地址
        /// </summary>
        public string Avatarurl
        {
            get { return avatarurl; }
            set { avatarurl = value; }
        }
        private long displayorder;
        /// <summary>
        /// 用户排序
        /// </summary>
        public long Displayorder
        {
            get { return displayorder; }
            set { displayorder = value; }
        }

        private long postcount;
        /// <summary>
        /// 用户文章数量
        /// </summary>
        public long Postcount
        {
            get { return postcount; }
            set { postcount = value; }
        }
        private long commentcount;
        /// <summary>
        /// 用户评论数量
        /// </summary>
        public long Commentcount
        {
            get { return commentcount; }
            set { commentcount = value; }
        }

        private DateTime createdate;
        /// <summary>
        /// 用户创建日期
        /// </summary>
        public DateTime Createdate
        {
            get { return createdate; }
            set { createdate = value; }
        }


        public string Url
        {

            get
            {
                string url = string.Empty;
                    url = string.Format("{0}member.aspx?username={1}", RequestHelper.SiteUrl, StringHelper.UrlEncode(this.UserName));
                    return url;
            }
        }

        /// <summary>
        /// 连接
        /// </summary>
        public string Link
        {
            get { return string.Format("<a href=\"{0}\" title=\"作者:{1}\">{1}</a>", this.Url, this.Name); }
        }
    }
}
